<?php

declare(strict_types=1);

namespace ImiApp\WebSocketServer\Controller;


use Imi\ConnectionContext;
use Imi\Controller\WebSocketController;
use Imi\Server\WebSocket\Route\Annotation\WSRoute;
// use Imi\Server\WebSocket\Route\Annotation\WSConfig;
use Imi\Server\WebSocket\Route\Annotation\WSAction;
use Imi\Server\WebSocket\Route\Annotation\WSController;

use Imi\Config;
use Imi\Db\Db;

/**
 * 继承
 * @WSController
 */
class WsBase extends WebSocketController
{
    /**
     * 成功
     * @param string $msg
     * @param mixed $data
     * @return array
     */
    public function success($msg = '', $data = [], $type = 'auction', $code = 1)
    {
        return ['code' => $code, 'msg' => $msg, 'type' => $type, 'data' => $data];
    }

    /**
     * 错误
     * @param string $msg
     * @param mixed $data
     * @return array
     */
    public function error($msg = '', $data = [], $type = 'auction', $code = -1)
    {
        return ['code' => $code, 'msg' => $msg, 'type' => $type, 'data' => $data];
    }

}
